<?php

declare(strict_types=1);

namespace app\service\member;

use app\model\member\MemberModel;

class MemberService
{
    /**
     * 会员列表
     * @param array $param
     */
    public function memberList(array $param): array
    {
        $list = MemberModel::custom($param)
            ->with(['info'])
            ->order('id desc')
            ->pages($param)
            ->select();
        return list_fmt($list, MemberModel::custom($param)->count());
    }
    /**
     * 编辑会员信息
     * @param array $data
     * @param integer $id
     */
    public function memberEdit(array $data, int $id): void
    {
        $member = MemberModel::find($id);
        if (!$member) {
            tips('未找到会员信息');
        }
        $member->status = $data['status'];
        $member->save();
    }
}
